clear all
set more off
capture log close
pause on


capture set scheme s1color
capture grstyle init
capture grstyle set nogrid


/* SC */ capture cd  "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/"
/* KZ */ capture cd "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/"
 

import delimited using "lucid_dl_2021_04_26_short.csv", clear
set more off

************************************************************************************
* Failed pre-survey checks, informed consent, previews, etc
************************************************************************************
drop if status == "Survey Preview"
drop if infcon == "No"
drop if q39 == "No - sorry."
drop if attcheck != "Extremely interested,Very interested"
drop if treatment == .

* xx drop the variables that were internal and not collected.

************************************************************************************
* Randomization and blocking checks
************************************************************************************

* Legal pretreatment randomization [worked, about 50/50]
tab legalpretmt 
* Treatment randomization [worked, about even]
tab treatment
* Blocking based on pretreatment legal answer [worked, about even]
bysort legalpretmt: tab treatment
* We blocked everyone on categories of PID (+ US legal system if it was pretreatment)
* Need to double check xx


************************************************************************************
* Outcome Variables Setup
************************************************************************************

* Numeric, ordered versions of outcome variables

foreach dvar in iccinv usinv {
	gen supp`dvar'_num = .
	replace supp`dvar'_num = 0 if supp`dvar' == "Strongly disagree"
	replace supp`dvar'_num = 1 if supp`dvar' == "Somewhat disagree"
	replace supp`dvar'_num = 2 if supp`dvar' == "Neither agree nor disagree" & supp`dvar'lean == "Lean towards disagreeing"
	replace supp`dvar'_num = 3 if supp`dvar' == "Neither agree nor disagree" & supp`dvar'lean == "Lean towards agreeing"
	replace supp`dvar'_num = 4 if supp`dvar' == "Somewhat agree"
	replace supp`dvar'_num = 5 if supp`dvar' == "Strongly agree"
	}
*

foreach dvar in bias usjoin {
	gen `dvar'_num = .
	replace `dvar'_num = 0 if `dvar' == "Strongly disagree" | `dvar' == "Strongly diagree"
	replace `dvar'_num = 1 if `dvar' == "Somewhat disagree"
	replace `dvar'_num = 2 if `dvar' == "Neither agree nor disagree"
	replace `dvar'_num = 3 if `dvar' == "Somewhat agree"
	replace `dvar'_num = 4 if `dvar' == "Strongly agree"	
	}
*

foreach dvar in iccinv usinv {
	gen supp`dvar'_num5 = .
	replace supp`dvar'_num5 = 0 if supp`dvar' == "Strongly disagree"
	replace supp`dvar'_num5 = 1 if supp`dvar' == "Somewhat disagree"
	replace supp`dvar'_num5 = 2 if supp`dvar' == "Neither agree nor disagree"
	replace supp`dvar'_num5 = 3 if supp`dvar' == "Somewhat agree"
	replace supp`dvar'_num5 = 4 if supp`dvar' == "Strongly agree"
	}
*



* Binary versions of outcome variables
*	- Outcome 1, support for ICC investigations
gen suppinv_bin = .
replace suppinv_bin = 1 if suppiccinv == "Somewhat agree" | suppiccinv == "Strongly agree"
replace suppinv_bin = 0 if suppiccinv == "Somewhat disagree" | suppiccinv == "Strongly disagree"
replace suppinv_bin = 1 if (suppiccinv == "Neither agree nor disagree" & suppiccinvlean == "Lean towards agreeing")
replace suppinv_bin = 0 if (suppiccinv == "Neither agree nor disagree" & suppiccinvlean == "Lean towards disagreeing")

*	- Outcome 2, support for US investigations
gen usinv_bin = .
replace usinv_bin = 1 if suppusinv == "Somewhat agree" | suppusinv == "Strongly agree"
replace usinv_bin = 0 if suppusinv == "Somewhat disagree" | suppusinv == "Strongly disagree"
replace usinv_bin = 1 if (suppusinv == "Neither agree nor disagree" & suppusinvlean == "Lean towards agreeing")
replace usinv_bin = 0 if (suppusinv == "Neither agree nor disagree" & suppusinvlean == "Lean towards disagreeing")

*	- Outcome 3*, bias against US; "neither agree nor disagree" is coded as 0.  We didn't ask a lean question here.
gen bias_bin = .
replace bias_bin = 1 if bias == "Somewhat agree" | bias == "Strongly agree"
replace bias_bin = 0 if bias == "Somewhat disagree" | bias == "Strongly diagree" | bias == "Strongly disagree" | bias == "Neither agree nor disagree"
*	There was a typo in the response options.  "Strongly diagree".  Fixed on 3-24, so some of the launch surveys will still have the error.

*	- Outcome 4, join the ICC; "neither agree nor disagree" is coded as 0.  We didn't ask a lean question here.
gen usjoin_bin = .
replace usjoin_bin = 1 if usjoin == "Somewhat agree" | usjoin == "Strongly agree"
replace usjoin_bin = 0 if usjoin == "Somewhat disagree" | usjoin == "Strongly disagree" | usjoin == "Neither agree nor disagree"

gen iccjoin_num = .
replace iccjoin_num = 0 if usjoin == "Strongly disagree"
replace iccjoin_num = 1 if usjoin == "Somewhat disagree"
replace iccjoin_num = 2 if usjoin == "Neither agree nor disagree"
replace iccjoin_num = 3 if usjoin == "Somewhat agree"
replace iccjoin_num = 4 if usjoin == "Strongly agree"



************************************************************************************
* Treatment Indicators Setup
************************************************************************************
foreach ind in control compl bias biascompl biashr  {
	gen tmt_`ind' = 0
	}
replace tmt_control = 1 if treatment == 0
replace tmt_comp = 1 if treatment == 1
replace tmt_bias = 1 if treatment == 2
replace tmt_biascomp = 1 if treatment == 3
replace tmt_biashr = 1 if treatment == 4

gen eithercompl = .
replace eithercompl = 1 if treatment == 1 | treatment == 3
replace eithercompl = 0 if treatment == 0 | treatment == 2 | treatment == 4

gen eitherbias = .
replace eitherbias = 1 if treatment == 2 | treatment == 3 | treatment == 4
replace eitherbias = 0 if treatment == 0 | treatment == 1

* Labelling the treatment values
label define treatment 0 "control" 1 "complementarity" 2 "bias" 3 "bias + complementarity" 4 "bias + human rights"

************************************************************************************
* Respondent characteristics setup (questions we asked)
************************************************************************************

* US legal system (dom1/2/3 are federal government, military, CIA)
gen uslegalsystem_bin = .
replace uslegalsystem_bin = 1 if uslegalsystem == "Somewhat agree" | uslegalsystem == "Strongly agree"
replace uslegalsystem_bin = 0 if uslegalsystem == "Somewhat disagree" | uslegalsystem == "Strongly disagree" | uslegalsystem == "Neither agree nor disagree"

* Trust in domestic institutions
foreach var in dom1 dom2 dom3 {
	gen `var'_num = .
	replace `var'_num = 0 if `var' == "Never"
	replace `var'_num = 2 if `var' == "Only sometimes"
	replace `var'_num = 3 if `var' == "Most of the time"
	replace `var'_num = 4 if `var' == "Just about always"
	}
gen dominst_sum = dom1_num + dom2_num + dom3_num
gen dominst_mean = (dom1_num + dom2_num + dom3_num)/3
	* Double check that there are no missing values that would mess up the means; may need rowmean with a !missing conditional

* Trust in international institutions (variables are io1-io6; "do what is right", "portion of resources for their mission", "address practical world problems", "accomplish mission/goals"
*	"efficient with resources," "biased against some countries")
* Constructing numerical scales for each of the io# variables; higher numbers more positive for ios.
gen io1_num = .
	replace io1_num = 3 if io1 == "Just about always"
	replace io1_num = 2 if io1 == "Most of the time"
	replace io1_num = 1 if io1 == "Only sometimes"
	replace io1_num = 0 if io1 == "Never"
gen io2_num = .
	replace io2_num = 3 if io2 == "All"
	replace io2_num = 2 if io2 == "Most"
	replace io2_num = 1 if io2 == "Some"
	replace io2_num = 0 if io2 == "Little to none"
forvalues i = 4(1)5 {
	gen io`i'_num = .
	replace io`i'_num = 0 if io`i' == "Strongly disagree"
	replace io`i'_num = 1 if io`i' == "Somewhat disagree"
	replace io`i'_num = 2 if io`i' == "Neither agree nor disagree"
	replace io`i'_num = 3 if io`i' == "Somewhat agree"
	replace io`i'_num = 4 if io`i' == "Strongly agree"
	}
gen io6_num = .
	replace io6_num = 4 if io6 == "Strongly disagree"
	replace io6_num = 3 if io6 == "Somewhat disagree"
	replace io6_num = 2 if io6 == "Neither agree nor disagree"
	replace io6_num = 1 if io6 == "Somewhat agree"
	replace io6_num = 0 if io6 == "Strongly agree"
gen io_sum = io1_num + io2_num + io4_num + io5_num + io6_num

gen io_mean = (io1_num + io2_num + io4_num + io5_num + io6_num)/5
	* xx double check that there are no missing values that would mess up the means; may need rowmean with a !missing conditional
	* io3 is a question about bias, so excluded here since it could be affected by treatment
	* xx check if treatment affects any of the io vars.
	
*** Newshours
* Median is 6
gen newshours_morethan6 = 0
replace newshours_morethan6 = 1 if newshours > 6

* PID, from questions
gen dem_broad = .	
	replace dem_broad = 1 if q77 == "A Democrat" | ascloserdemrep == "The Democratic Party"
	replace dem_broad = 0 if q77 == "A Republican" | ascloserdemrep == "The Republican Party"
gen rep_broad = .	
	replace rep_broad = 1 if q77 == "A Republican" | ascloserdemrep == "The Republican Party"
	replace rep_broad = 0 if q77 == "A Democrat" | ascloserdemrep == "The Democratic Party"
	
* This variable takes the PID questions and orders people along a spectrum from (0) lean very strongly D, lean somewhat D, [didn't pick D, then said closer to D], [didn't pick R, then said closer to R]
*	lean somewhat R, (5) lean very strongly R
gen demrep_ordered = .
replace demrep_ordered = 0 if demlean == "Lean very strongly Democrat"
replace demrep_ordered = 1 if demlean == "Lean somewhat Democrat"
replace demrep_ordered = 2 if ascloserdemrep == "The Democratic Party"
replace demrep_ordered = 3 if ascloserdemrep == "The Republican Party"
replace demrep_ordered = 4 if replean == "Lean somewhat Republican"
replace demrep_ordered = 5 if replean == "Lean very strongly Republican"

************************************************************************************
* Respondent characteristics setup (Lucid piped in information)
************************************************************************************

* age is fine

* gender
gen female = .
replace female = 1 if gender == 2
replace female = 0 if gender == 1

* education is numerical, 1-8, it ranges from:
*	Some high school or less; High school graduate; Other post high school vocational training; Completed some college, but no degree; Associate's degree; Bachelor's degree; Master's or professional degree; Doctorate degree
gen baorhigher = .
replace baorhigher = 1 if education >= 6
replace baorhigher = 0 if education < 6

* ethnicity has 16 values; hispanic has 15 values; they generate this series of indicators; there were also "prefer not to answer" I didn't treat these as missing
foreach var in white black asianpi hispanic {
	gen `var'_bin = 0
	}
replace white_bin = 1 if ethnicity == 1
replace black_bin = 1 if ethnicity == 2
replace asianpi_bin = 1 if ethnicity >=4 & ethnicity <= 14
replace hispanic_bin = 1 if hispanic != 1

* hhi has 24 values, and includes a "prefer not to answer" option, I did code that as missing
rename hhi hhi_lucid
gen hhi = hhi_lucid
replace hhi = . if hhi == -3105

* political party is 10 point scale; Strong Democrat, Not very strong Democrat, Independent Democrat, Independent - neither, Independent Republican, Other - leaning Democrat, Other - neither
*	Other - leaning Republican, Not very strong Republican, Strong Republican
gen lucid_anydem = 0
replace lucid_anydem = 1 if political_party <= 3 | political_party == 6
gen lucid_anyrep = 0
replace lucid_anyrep = 1 if political_party >= 8 | political_party == 5
*		These seem pretty highly correlated with what people answered, at least in the binary forms
*		tab lucid_anyrep rep_broad
*		tab lucid_anydem dem_broad

* region (translated into indicators)
foreach var in northeast midwest west south {
	gen region_`var' = 0
	}
replace region_northeast = 1 if region == 1
replace region_midwest = 1 if region == 2
replace region_south = 1 if region == 3
replace region_west = 1 if region == 4

************************************************************************************
* Manipulation, comprehension checks; time spent on treatments 
************************************************************************************

gen mancheck1_correct = 0
replace mancheck1_correct = 1 if mancheck1 == "Afghanistan"
gen mancheck2_correct = 0
replace mancheck2_correct = 1 if mancheck2 == "The International Criminal Court (ICC)"
gen mancheck_correct_total = mancheck1_correct + mancheck2_correct

gen ccheck1_correct = 0
replace ccheck1_correct = 1 if ccheck1 == "That country already has a meaningful investigation into the crimes."
gen ccheck2_correct = 0
replace ccheck2_correct = 1 if ccheck2 == "The ICC cannot investigate these accusations."
gen ccheck_correct_total = ccheck1_correct + ccheck2_correct

* Time spent on reading treatments
gen timereadingtreatment = .
replace timereadingtreatment = timercontrol_pagesubmit if treatment == 0
replace timereadingtreatment = timerc_pagesubmit if treatment == 1
replace timereadingtreatment = timerbias_pagesubmit if treatment == 2
replace timereadingtreatment = timercbias_pagesubmit if treatment == 3
replace timereadingtreatment = timerchr_pagesubmit if treatment == 4

* "Complier" indicators

gen complier1 = 0
gen complier2 = 0
gen complier1and2 = 0

replace complier1 = 1 if eithercompl == 1 & ccheck1_correct == 1
replace complier1 = 1 if eithercompl == 0

replace complier2 = 1 if eithercompl == 1 & ccheck2_correct == 1
replace complier2 = 1 if eithercompl == 0

replace complier1and2 = 1 if eithercompl == 1 & ccheck1_correct == 1 & ccheck2_correct == 1
replace complier1and2 = 1 if eithercompl == 0

* Outsheeting for the Bowers/Hansen test in R
export delimited using us_working_2021_04_26.csv, replace



label variable tmt_compl "Compl." 
label variable tmt_bias "Bias" 
label variable tmt_biascompl "Bias + Compl." 
label variable tmt_biashr "Bias + HR" 
label variable tmt_control "Control" 
label variable suppinv_bin "Support ICC Inv."
label variable usinv_bin "Support US Inv." 
label variable bias_bin "ICC is biased" 
label variable usjoin_bin "Support ICC Memb." 
label variable uslegalsystem_bin "Leg. Sys. Cap." 
label variable female "Female" 
label variable age "Age" 
label variable white_bin "White" 
label variable baorhigher "BA or higher" 
label variable hhi "Household Income" 
label variable lucid_anydem "Democrat" 
label variable lucid_anyrep "Republican" 
label variable region_northeast "Northeast" 
label variable region_midwest "Midwest" 
label variable region_south "South" 
label variable region_west "West"



***
* Descriptive stats and balance
***

global ctrls female age white_bin baorhigher hhi demrep_ordered region_northeast region_midwest region_south region_west
*global ctrls2 uslegalsystem_bin female age white_bin baorhigher hhi lucid_anydem lucid_anyrep region_northeast region_south region_west
global dvs suppinv_bin usinv_bin bias_bin usjoin_bin
global treat_groups tmt_compl tmt_bias tmt_biascompl tmt_biashr

estpost su $treat_groups $dvs $ctrls
	est store full
estpost su $treat_groups $dvs $ctrls if tmt_compl == 1
	est store compl
estpost su $treat_groups $dvs $ctrls if tmt_bias == 1
	est store bias
estpost su $treat_groups $dvs $ctrls if tmt_biascompl == 1
	est store biascompl
estpost su $treat_groups $dvs $ctrls if tmt_biashr == 1
	est store biashr
estpost su $treat_groups $dvs $ctrls if tmt_control == 1
	est store ctrl

*	Making summary stats table, means only, full - treatment only - control only
	esttab full compl bias biascompl biashr ctrl ///
		using "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/meanstats_tmtctrl_labelled_usa.tex", replace ///
		cells(mean(fmt(2))) nodep nonum  ///
		mtitle("Full" "Compl." "Bias" "Bias + Compl." "Bias + HR" "Control") ///
		coeflabels(tmt_compl "Compl." tmt_bias "Bias" tmt_biascompl "Bias + Compl." tmt_biashr "Bias + HR" tmt_control "Control" ///
		suppinv_bin "Support ICC Inv." usinv_bin "Support US Inv." bias_bin "ICC is biased" usjoin_bin "Support ICC Memb" ///
		uslegalsystem_bin "Leg. Cap." female "Female" age "Age" white_bin "White" baorhigher "BA or higher" hhi "Household Income" ///
		demrep_ordered "Dem./Rep. Scale" region_northeast "Northeast" region_midwest "Midwest" region_south "South" region_west "West")


	
************************************************************************************
************************************************************************************

* ANALYSIS

************************************************************************************
************************************************************************************


***
* Simple looks at treatment effects
***

reg suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr

reg usinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr
reg bias_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr
reg usjoin_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr

bysort treatment: su suppinv_bin
bysort treatment: su usinv_bin
bysort treatment: su bias_bin
bysort treatment: su usjoin_bin

* Histogram, support for ICC investigations, control vs C treatment
twoway (histogram suppiccinv_num if tmt_control == 1, discr frac lcolor(gray) fcolor(gray) ///
	xlabel(0 "Strongly disagree" 1 "Somewhat disagree" 2 "Lean disagree" 3 "Lean agree" 4 "Somewhat agree" 5 "Strongly agree", ///
	labs(vsmall) angle(-45))) ///
	(histogram suppiccinv_num if tmt_compl == 1, discr frac fcolor(none) lcolor(black)), legend(order(1 "Control" 2 "Compl. Treatment")) ///
	xtitle("Support ICC Inv.") ylab(, nogrid) bgcolor(white) graphregion(color(white))
*	graph export "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/hist_iccinv_ctrlC.eps", as(eps) preview(off) replace
	graph export "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/hist_iccinv_ctrlC.eps", as(eps) preview(off) replace
	
* Histogram, support for US investigations, control vs C treatment
twoway (histogram suppusinv_num if tmt_control == 1, discr frac lcolor(gray) fcolor(gray) ///
	xlabel(0 "Strongly disagree" 1 "Somewhat disagree" 2 "Lean disagree" 3 "Lean agree" 4 "Somewhat agree" 5 "Strongly agree", ///
	labs(vsmall) angle(-45))) ///
	(histogram suppusinv_num if tmt_compl == 1, discr frac fcolor(none) lcolor(black)), legend(order(1 "Control" 2 "Compl. Treatment")) ///
	xtitle("Support US Inv.") ylab(, nogrid) bgcolor(white) graphregion(color(white))
*	graph export "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/hist_usinv_ctrlC.eps", as(eps) preview(off) replace
	graph export "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/hist_usinv_ctrlC.eps", as(eps) preview(off) replace

* Histogram, bias, control vs C treatment
twoway (histogram bias_num if tmt_control == 1, discr frac lcolor(gray) fcolor(gray) ///
	xlabel(0 "Strongly disagree" 1 "Somewhat disagree" 2 "Neither agree/disagree" 3 "Somewhat agree" 4 "Strongly agree", ///
	labs(vsmall) angle(-45))) ///
	(histogram bias_num if tmt_compl == 1, discr frac fcolor(none) lcolor(black)), legend(order(1 "Control" 2 "Compl. Treatment")) ///
	xtitle("ICC is biased") ylab(, nogrid) bgcolor(white) graphregion(color(white))
*	graph export "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/hist_bias_ctrlC.eps", as(eps) preview(off) replace
	graph export "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/hist_bias_ctrlC.eps", as(eps) preview(off) replace

* Histogram, US join, control vs C treatment
twoway (histogram usjoin_num if tmt_control == 1, discr frac lcolor(gray) fcolor(gray) ///
	xlabel(0 "Strongly disagree" 1 "Somewhat disagree" 2 "Neither agree/disagree" 3 "Somewhat agree" 4 "Strongly agree", ///
	labs(vsmall) angle(-45))) ///
	(histogram usjoin_num if tmt_compl == 1, discr frac fcolor(none) lcolor(black)), legend(order(1 "Control" 2 "Compl. Treatment")) ///
	xtitle("US Should Join ICC") ylab(, nogrid) bgcolor(white) graphregion(color(white))
*	graph export "/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/hist_usjoin_ctrlC.eps", as(eps) preview(off) replace
	graph export "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/hist_usjoin_ctrlC.eps", as(eps) preview(off) replace


	
***	
* Treatment effects
***	


** Bivariate regressions **


/* 
* Regressions of Dvs on treatment indicators, OLS and logit
 reg suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr
	est2vec iccinv, replace name(iccinv1) vars(tmt_compl tmt_bias tmt_biascompl tmt_biashr _cons)
 logit suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr
	est2vec iccinvlogit, replace name(iccinvlogit1) vars(tmt_compl tmt_bias tmt_biascompl tmt_biashr _cons)

foreach dvar in usinv_bin bias_bin usjoin_bin {
	 reg `dvar' tmt_compl tmt_bias tmt_biascompl tmt_biashr
		est2vec ols`dvar', replace name(reg`dvar') addto(iccinv)
	 logit `dvar' tmt_compl tmt_bias tmt_biascompl tmt_biashr
		est2vec logit`dvar', replace name(logit`dvar') addto(iccinvlogit)
	}
*
	*est2tex iccinv, preserve label path("/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero
	*est2tex iccinvlogit, preserve label path("/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero
	est2tex iccinv, preserve label path("/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero
	est2tex iccinvlogit, preserve label path("/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero
*/

eststo clear
eststo A1: reg suppinv_bin $treat_groups
eststo B1: reg usinv_bin $treat_groups
eststo C1: reg bias_bin $treat_groups
eststo D1: reg usjoin_bin $treat_groups
esttab A1 B1 C1 D1 using "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/slim_reg_usa.tex", label b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) replace

eststo A2: logit suppinv_bin $treat_groups
eststo B2: logit usinv_bin $treat_groups
eststo C2: logit bias_bin $treat_groups
eststo D2: logit usjoin_bin $treat_groups
esttab A2 B2 C2 D2 using "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/slim_logit_usa.tex", label b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) replace



** Multivariate regressions **


* OLS
eststo clear
eststo A3: reg suppinv_bin $treat_groups $ctrls2
eststo B3: reg usinv_bin $treat_groups $ctrls2
eststo C3: reg bias_bin $treat_groups $ctrls2
eststo D3: reg usjoin_bin $treat_groups $ctrls2
esttab A3 B3 C3 D3 using "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/full_reg_usa.tex", label b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) replace



** Interaction term regressions **		

gen compl_legsys     = uslegalsystem_bin*tmt_compl
gen bias_legsys      = uslegalsystem_bin*tmt_bias
gen biascompl_legsys = uslegalsystem_bin*tmt_biascompl
gen biashr_legsys    = uslegalsystem_bin*tmt_biashr

label variable compl_legsys "Compl. * Leg. Sys. Cap." 
label variable bias_legsys "Bias * Leg. Sys. Cap." 
label variable biascompl_legsys "Bias + Compl. * Leg. Sys. Cap." 
label variable biashr_legsys "Bias + HR * Leg. Sys. Cap." 

global treat_int compl_legsys bias_legsys biascompl_legsys biashr_legsys

* OLS
eststo clear
eststo A4: reg suppinv_bin $treat_groups $treat_int
eststo A5: reg suppinv_bin $treat_groups $treat_int $ctrls2
eststo B4: reg usinv_bin $treat_groups $treat_int
eststo B5: reg usinv_bin $treat_groups $treat_int $ctrls2
eststo C4: reg bias_bin $treat_groups $treat_int
eststo C5: reg bias_bin $treat_groups $treat_int $ctrls2
eststo D4: reg usjoin_bin $treat_groups $treat_int
eststo D5: reg usjoin_bin $treat_groups $treat_int $ctrls2
esttab A4 A5 B4 B5 C4 C5 D4 D5 using "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/int_reg_usa.tex", label b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) replace


* OLS if legalpretmt ==1
eststo clear
eststo A4: reg suppinv_bin $treat_groups $treat_int if legalpretmt ==1
eststo A5: reg suppinv_bin $treat_groups $treat_int $ctrls2 if legalpretmt ==1
eststo B4: reg usinv_bin $treat_groups $treat_int if legalpretmt ==1
eststo B5: reg usinv_bin $treat_groups $treat_int $ctrls2 if legalpretmt ==1
eststo C4: reg bias_bin $treat_groups $treat_int if legalpretmt ==1
eststo C5: reg bias_bin $treat_groups $treat_int $ctrls2 if legalpretmt ==1
eststo D4: reg usjoin_bin $treat_groups $treat_int if legalpretmt ==1
eststo D5: reg usjoin_bin $treat_groups $treat_int $ctrls2 if legalpretmt ==1
esttab A4 A5 B4 B5 C4 C5 D4 D5 using "/Users/kelebogilezvobgo/Dropbox/Complementarity/Survey_US/Lucid data Mar 2021/int_reg_usa2.tex", label b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) replace





/*
* Regressions of Dvs on treatment indicators, OLS and logit, no speeders
 reg suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr if timereadingtreatment > 15 & timereadingtreatment < 180
	est2vec iccinvnospeed, replace name(iccinv1) vars(tmt_compl tmt_bias tmt_biascompl tmt_biashr _cons)
 logit suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr if timereadingtreatment > 15 & timereadingtreatment < 180
	est2vec iccinvlogitnospeed, replace name(iccinvlogit1) vars(tmt_compl tmt_bias tmt_biascompl tmt_biashr _cons)

foreach dvar in usinv_bin bias_bin usjoin_bin {
	 reg `dvar' tmt_compl tmt_bias tmt_biascompl tmt_biashr if timereadingtreatment > 15 & timereadingtreatment < 180
		est2vec ols`dvar', replace name(reg`dvar') addto(iccinvnospeed)
	 logit `dvar' tmt_compl tmt_bias tmt_biascompl tmt_biashr if timereadingtreatment > 15 & timereadingtreatment < 180
		est2vec logit`dvar', replace name(logit`dvar') addto(iccinvlogitnospeed)
	}
*
	est2tex iccinvnospeed, preserve label path("/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero
	est2tex iccinvlogitnospeed, preserve label path("/Users/robertchaudoin/Dropbox/Complementarity ZC/Survey_US/Lucid data Mar 2021/") mark(stars) fancy replace levels(90 95 99) leadzero

	

***
* Did treatment affect perceptions of US legal system
***
bysort treatment: su uslegalsystem_bin if legalpretmt == 0

***
* Simple looks at treatment effects, by uslegalsystem, pre-treatment only
***
bysort uslegalsystem_bin: reg suppinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr if legalpretmt == 0
bysort uslegalsystem_bin: reg usinv_bin tmt_compl tmt_bias tmt_biascompl tmt_biashr if legalpretmt == 0

** STEPHEN, isn't this post-treatment only if legalpretmt==0?



***
* Treatment and manipulation/comprehension checks
***

* Did getting *either* of the complementarity treatments affect comprehension?
tab eithercompl ccheck_correct_total
bysort eithercompl: su ccheck_correct_total
bysort eithercompl: su ccheck1_correct
bysort eithercompl: su ccheck2_correct

*/
